package com.xiao.webtest.service;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xiao.webtest.dao.UserDao;
import com.xiao.webtest.entity.UserEntity;

/**
 * Created by xiaoliang on 2014/11/17 14:12.
 */
@Service("userService")
public class UserServiceImpl implements UserService{
	private static Log log = LogFactory.getLog(UserServiceImpl.class);
	
    @Autowired
    private UserDao userDao;

    public int update(UserEntity user) {
		UserEntity trueUser = userDao.getById(user.getId());
		trueUser.setPassword(user.getPassword());
        return userDao.update(user);
    }
    
    public UserEntity getById(long id) {
        return userDao.getById(id);
    }

	public UserEntity getByName(String name) {
		return userDao.getByName(name);
	}
    
    
}
